<?php
/**
 * Signalsy Platform Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@wheemplay.com so we can send you a copy immediately.
 *
 * @category   Signalsy
 * @package    Signalsy Core
 * @copyright  Copyright (c) 2009 AGPsource Team
 * @license    http://signalsy.com/license/ New BSD License
 */

 //error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
 //! при использовании XCache могут быть E_WARNING сообщения от загрузчика, их можно игнорировать
 error_reporting(E_ALL); // & ~E_WARNING & ~E_STRICT & ~E_NOTICE);
 $mem_start = memory_get_usage();
 
 try
 {
 	
 require_once('/inc/lib/Signalsy/Core.php');
 
 //staring routings
 $router = Signalsy_Router::getInstance($config);
 
 Zend_Registry::set('mem_start', $mem_start);
 
 //rewrite base URL, default for index = www.domain.com/sire/index
 if ((empty($_REQUEST['__route__'])) || ($_REQUEST['__route__'] == '/') || (!isset($_REQUEST['__route__'])))
 {
	$_REQUEST['__route__'] = '';
 }
 
 
 //start dispatch
 $router->dispatchURL($_REQUEST['__route__']);
 
 
 Framework_SignalsyCore::dumpRoutingsTable();
 
 }
 catch (Signalsy_Exception $e)
 {
	
	if (Zend_Registry::isRegistered('ajax_log'))
	{
		Zend_Registry::get('ajax_log')->log($e, Zend_Log::ERR);
	}
 }
 
 
 
 
 //output all and flush buffers correctly
 if (is_object($router))
 {
 	if (Zend_Registry::isRegistered('ajax_log'))
	{
		Zend_Registry::get('ajax_log')->log($router, Zend_Log::INFO);
	}
	
 	$router->outputAll();
 }